﻿using FluentNHibernate.Conventions;
using FluentNHibernate.Conventions.Instances;

namespace HashFoo.Nhib.Spatial
{
    /// <summary>
    /// MsSqlGeometry mapping default convention (so we don't need overrides).
    /// </summary>
    /// <remarks>
    /// See: http://wiki.fluentnhibernate.org/Available_conventions#UserTypeConvention documentation.
    /// </remarks>
    public class HashFooGeographyTypeConvention : UserTypeConvention<HashFooGeographyType>
    {
        /// <summary>
        /// Apply the convention.
        /// </summary>
        /// <param name="instance"></param>
        public override void Apply(IPropertyInstance instance)
        {
            base.Apply(instance);
            instance.CustomSqlType("geometry");
        }
    }
}
